<%@ page pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<title>文章编辑</title>
	<%@include file="/common/jsp/taglib.jsp"%>
	<script type="text/javascript" charset="utf-8" src="${ctx }common/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="${ctx }common/ueditor/ueditor.all.min.js"> </script>
    <link rel="stylesheet" type="text/css" href="${ctx }common/system/assets/bootstrap-fileupload/bootstrap-fileupload.css" />
    <script type="text/javascript" src="${ctx }common/system/assets/bootstrap-fileupload/bootstrap-fileupload.js"></script>
	<script type="text/javascript" src="${ctx }common/system/assets/fuelux/js/spinner.min.js"></script>
	
  
  
	<script type="text/javascript" >
	
	$(function(){
		common.refreshSelect2('type','code2nameOfProperties','article_type',function(){
			$("#type").val('${entity.type }');
		});
		
		$('#spinner4').spinner({value:1, step: 1, min: 1, max: 200});
		
	});
	function submitform(){
		var d = $("#articleform").serialize();
		var url = ctx + "article/saveArticle.do";
		//console.info(d);  editorValue  ueditor的内容 
		common.submitForm2Path('articleform',url);
		return ;
		
	}
	
	function removePic(){
		console.info(1);
		$("#imgPath").val('');
	}
	
	</script>
    
</head>
<body>
				<!-- 主体内容开始 -->
				<div class="row">
					<div class="col-lg-12">
						<section class="panel">
 							<header class="panel-heading">
 								<span class="label label-success label-mini"><b>文章编辑</b></span>
 							</header> 
							<div class="panel-body">
								<form class="form-horizontal tasi-form" role="form" id="articleform" >
									<div class="form-group"> 
                                          <label class="col-sm-2 col-sm-2 control-label"><b>标题</b></label>
                                          <div class="col-sm-10">
                                              <input type="text" id="head" name="head" class="form-control" value="${entity.head }"> 
                                          </div>
                                    </div>
                                    <div class="form-group"> 
                                          <label class="col-sm-2 col-sm-2 control-label"><b>副标题</b></label>
                                          <div class="col-sm-10">
                                              <input type="text" id="subhead" name="subhead" value="${entity.subhead }" class="form-control" > 
                                          </div>
                                    </div>
                                    
                                    <div class="form-group"> 
                                          <label class="col-sm-2 col-sm-2 control-label"><b>文章类别</b></label>
                                          <div class="col-sm-10">
                                              <select type="text" id="type" name="type"class="form-control" >
                                              </select> 
                                          </div>
                                    </div>
                                    
                                    
                                    <!-- 
                                    <div class="form-group">
                                    	<label class="col-sm-2 col-sm-2 control-label"><b>配图</b></label>
                                    	<div class="col-sm-10">
                                    		<div data-provides="fileupload" class="fileupload fileupload-new">
                                                  <div style="width: 200px; height: 150px;" class="fileupload-new thumbnail">
                                                      <img alt="" src="http://www.placehold.it/200x150/EFEFEF/AAAAAA&amp;text=no+image">
                                                  </div>
                                                  <div style="max-width: 200px; max-height: 150px; line-height: 20px;" class="fileupload-preview fileupload-exists thumbnail"></div>
                                                  <div>
                                                   <span class="btn btn-white btn-file">
                                                   <span class="fileupload-new"><i class="icon-paper-clip"></i> Select image</span>
                                                   <span class="fileupload-exists"><i class="icon-undo"></i> Change</span>
                                                   <input type="file" class="default" id="imgPath">
                                                   </span>
                                                      <a data-dismiss="fileupload" onclick="removePic();" class="btn btn-danger fileupload-exists" href="javascript:void(0);"><i class="icon-trash"></i> Remove</a>
                                                  </div>
                                              </div>
                                          </div>
                                    </div>
                                     -->
                                    <div class="form-group"> 
                                          <label class="col-sm-2 col-sm-2 control-label"><b>起始文字</b></label>
                                          <div class="col-sm-10">
                                              <input type="text" id="startText" name="startText" value="${entity.startText }" class="form-control" maxlength="50" > 
                                          </div>
                                    </div>
                                    
                                    <div class="form-group">
										<label class="col-sm-2 col-sm-2 control-label"><b>菜单序号</b></label>
										<div class="col-sm-10">
											<div id="spinner4"> 
											
											
												<div style="width:150px;" class="input-group">
                                                      <div class="spinner-buttons input-group-btn">
                                                          <button class="btn spinner-up btn-warning" type="button">
                                                              <i class="icon-plus"></i>
                                                          </button>
                                                      </div>
                                                      <input type="text" id="position" name="position" readonly="" maxlength="3" value="${entity.position }" class="spinner-input form-control">
                                                      <div class="spinner-buttons input-group-btn">
                                                          <button class="btn spinner-down btn-danger" type="button">
                                                              <i class="icon-minus"></i>
                                                          </button>
                                                      </div>
                                                  </div>
											
                                               
                                               
                                               
                                            </div>
										</div>
									</div>
									
									
                                    <div class="form-group">
										<label class="col-sm-2 col-sm-2 control-label"><b>内容</b></label>
										<div class="col-sm-10">
											<script id="editor_content" type="text/plain" style="width:100%;height:400px;">
											</script>
										</div>
									</div>
									<div class="form-group text-center">
										<input type="hidden" id="id" name="id" value="${entity.id}"/>
										<input type="hidden" name="statement" value="${statement }"  />
										<input type="hidden" name="tourl" value="${tourl }"  />
										<button type="button" class="btn btn-info" onclick="submitform();"><i class="icon-ok"></i><b>&nbsp;提 交</b></button> 
										<button type="button" class="btn btn-info" onclick="common.backToList();"><i class="icon-reply"></i><b>&nbsp;返 回</b></button> 
									</div>
								</form>
							</div>
						</section>
					</div>
				</div>
				<!-- 主体内容结束 -->
				
<script type="text/javascript">

   var ue = UE.getEditor('editor_content');
   /*方法1 
   ue.ready(function() {
	   ue.setContent('UEditor报错TypeError: me.body is undefined');
	   }); */
	//方法2
   ue.addListener("ready", function () {
	   $(function(){
		   common.jajax(ctx+"article/content.do?id=${entity.id}",function(d){
			   	//直接el表达式设置不行, 会有特殊字符的问题. 
				ue.setContent(d.content);
			   	
		   });
	   });
	});
	
	   
  
   
</script>
    
    
</body>
</html>